<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="test"></div>
  <div id="test1"></div>
  <div id="test2"></div>

  <script src="../js/react.development.js"></script>
  <script src="../js/react-dom.development.js"></script>
  <script src="../js/babel.min.js"></script>
  <!-- props限制 -->
  <script src="../js/prop-types.js"></script> 

  <script type="text/babel">
    function Person (props) {
      const {name, age, gender} = props
      return (
        <ul>
            <li>姓名:{name}</li>
            <li>年龄:{age}</li>
            <li>性别:{gender}</li>
          </ul>
      )
    }

    // 必要性限制
    Person.propTypes = {
      name: PropTypes.string.isRequired,
      age:PropTypes.number,
      gender: PropTypes.string,
      speak: PropTypes.func
    }
    // 默认值限制
    Person.defaultProps = {
      gender: 'female',
      age: 21
    }
    

    ReactDOM.render (<Person name='tommy' />, document.getElementById ('test'))


   
  </script>
</body>
</html>